package b1.utils
{
	import b1.players.*;
	
	import flash.filters.*;
	import flash.text.*;
	
	public class BFont
	{
		static public const brightFilter:Array =
				[1,0,0,0,15,
			     0,1,0,0,15,
			     0,0,1,0,15,
			     0,0,0,1,0 ];
		static public const darkFilter:Array =
				[1,0,0,0,-50,
			     0,1,0,0,-50,
			     0,0,1,0,-50,
			     0,0,0,1,0 ];
		static public const normalFilter:Array =
				[1,0,0,0,0,
			     0,1,0,0,0,
			     0,0,1,0,0,
			     0,0,0,1,0 ];
		static public const blackWhiteFilter:Array = [0.3086, 0.6094, 0.0820, 0, 0,
		 											  0.3086, 0.6094, 0.0820, 0, 0,
												      0.3086, 0.6094, 0.0820, 0, 0,
												      0,      0,      0,      1, 0];
		static public const redFilter:Array = [1,0,0,0,100,
								    		   0,1,0,0,0,
										       0,0,1,0,0,
										       0,0,0,1,0 ];
		static public const yellowFilter:Array = [1,0,0,0,100,
								    		   0,1,0,0,100,
										       0,0,1,0,0,
										       0,0,0,1,0 ];
		static public const greenFilter:Array = [1,0,0,0,0,
								    		     0,2,0,0,100,
										         0,0,1,0,0,
										         0,0,0,1,0 ];
		static public const blueFilter:Array = [1,0,0,0,0,
								    		     0,1,0,0,0,
										         0,0,2,0,100,
										         0,0,0,1,0 ];
		static public const stageWidth:int = 800;
		static public const stageHeight:int = 600;
		static public const userNameColor:int = 0x0000FF;
		static public const animalNameColor:int = 0xFF0000;
		static public const	greenFontGlowFilter:GlowFilter = new GlowFilter(0x72D52C, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH);
//		static public const roundRecColor:int = 0xF9E27B;
		static public const roundRecColor:int = 0x60442B;

		public function BFont()
		{
		}

		public static function getAnimalFullName(animal:AnimalInfo, fontSize:int = 15):TextField
		{
			var animalFullNameText:TextField = new TextField();
			var animalOwnerName:String = animal.ownerName.substr(0, 4);
			animalFullNameText.selectable = false;
        	animalFullNameText.autoSize = TextFieldAutoSize.LEFT;
			animalFullNameText.text = animalOwnerName + "的" + animal.animalName;
			animalFullNameText.setTextFormat(new TextFormat("微软雅黑", fontSize, BFont.userNameColor), 0, animalOwnerName.length);
			animalFullNameText.setTextFormat(new TextFormat("微软雅黑", fontSize, 0x000000), animalOwnerName.length, animalOwnerName.length + 1);
			animalFullNameText.setTextFormat(new TextFormat("微软雅黑", fontSize, BFont.animalNameColor), animalOwnerName.length + 1, animalFullNameText.text.length);
			return animalFullNameText;
		}
			
	}
}